package com.itheima.dao.impl;

import com.itheima.dao.SingletonTemplate;
import com.itheima.dao.UserDao;
import com.itheima.dao.UserRowMapper;
import com.itheima.model.User;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository("userDao")
public class UserDaoImpl implements UserDao {
    public List<User> find_all(){
        JdbcTemplate jdbcTemplate = SingletonTemplate.getJdbcTemplate();
        String sql = "SELECT * FROM users";
        List<User> users = jdbcTemplate.query(sql,new UserRowMapper());
        return users;
    }

    public void save() {

    }
}
